<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="mapui"></div>

    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>

    <script>
        

        var amap = null;
        map.Factory.create('mapui', {
            style: style,
            center: center,
            zoom: 10,
            maxZoom: 19, //地图最大级别
            minZoom: 1, //地图最小级别
            strategy: ['mapboxgl', 'openlayers', 'leaflet'],
            fullExtent: {
                xmin: 108.23365,
                ymin: 17.95253,
                xmax: 111.78395,
                ymax: 20.13104
            }
        }, (o) => {
            amap = o;
            let orginMap = amap.getMap();
            orginMap.loadImage('./js_example/images/marker.png', function (error, image) {

                orginMap.addImage('customIcon', image);

                var point = {
                    "type": "FeatureCollection",
                    "features": [{
                        "type": "Feature",
                        "geometry": {
                            "type": "Point",
                            "coordinates": [113.322646, 23.101359]
                        },
                        "properties": {
                            "title": "医院",
                            "icon": "monument"
                        }
                    }, {
                        "type": "Feature",
                        "geometry": {
                            "type": "Point",
                            "coordinates": [113.422646, 23.201359]
                        },
                        "properties": {
                            "title": "大学",
                            "icon": "monument"
                        }
                    }]
                };

                amap.addSource("Point_GEOJSON", {
                    "type": "geojson",
                    "data": point
                });


                let layer = amap.addLayer("pointLayer", "Point_GEOJSON", {
                    'type': 'symbol',
                    "layout": {
                        "text-field": "{title}",
                        "text-offset": [0, 0.6],
                        "text-anchor": "top",
                        "icon-image": "customIcon",
                        "icon-size": 0.25
                    }
                });
            });

        });
    </script>
</body>

</html>